﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ESRI.ArcGIS.Geodatabase;

namespace Akiha.Core
{
    public static class FeatureWrapper
    {
        /// <summary>
        /// 获取要素字段值
        /// </summary>
        /// <param name="Feature">要查询的要素</param>
        /// <param name="Field">字段名称</param>
        /// <returns></returns>
        public static object GetFieldValue(IFeature Feature, string Field)
        {
            IFields pFields = Feature.Fields;
            int index = pFields.FindField(Field);
            if (index == -1)
            {
                return "";
            }
            object value = Feature.get_Value(pFields.FindField(Field));
            return value;
        }

        public static IFeatureClass GetFeatureClass(IFeature feature)
        {
            if (feature == null)
            {
                return null;
            }
            IFeatureClass featureClass = feature.Class as IFeatureClass;

            return featureClass;
        }
    }
}
